package com.mmall.common.enums;

/**
 * @author gg
 * @version ProductStatusEnum.java, v 0.1 2019-05-05 11:40 gg
 */
public enum ProductStatusEnum {

    WAIT_FOR(1,"未上架"),
    ON_SALE(2,"在售"),
    LOWER_SHELF(3,"下架")
    ;
    private String desc;
    private Integer code;

    ProductStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Getter method for property <tt>value</tt>.
     *
     * @return property value of value
     */
    public Integer getCode() {
        return code;
    }

    public static ProductStatusEnum getByValue(Integer value) {
        ProductStatusEnum[] valueList = ProductStatusEnum.values();
        for (ProductStatusEnum v : valueList) {
            if (v.getCode().equals(value)) {
                return v;
            }
        }
        return null;
    }
}